#ifndef _RINGBUFFER_DRV_H_
#define _RINGBUFFER_DRV_H_

#include "r_cg_macrodriver.h"
#define QUEUE_OK        1
#define QUEUE_FAIL      0
#define OVER_WRITE      1

#define FRAME_INTERVAL  20

typedef struct
{
    uint16_t Read;
    uint16_t Write;
    uint16_t Size;
    uint8_t *Source;

    uint8_t Interval;
    uint8_t Done;
    
    uint8_t SendBusy;
}RingBuffer_Handle_t;

typedef bit err_code_t;

void Queue_Init(RingBuffer_Handle_t *handle, uint8_t *buf, uint16_t size);
err_code_t Queue_Push(RingBuffer_Handle_t *handle, uint8_t byte);
err_code_t Queue_Pop(RingBuffer_Handle_t *handle, uint8_t *byte);
uint16_t Queue_PopAll(RingBuffer_Handle_t *handle, uint8_t *buf);
err_code_t QueueIsEmpty(RingBuffer_Handle_t *handle);

#endif